package com.vipboot.aot.autoconfig;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReflectUtil;
import com.vipboot.framework.core.spring.SpringContextUtil;
import com.vipboot.framework.jackson.util.JsonUtil;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;

import java.util.stream.Stream;

public class AppNativeRuntimeHintsRegistrar implements RuntimeHintsRegistrar {
    @Override
    public void registerHints(RuntimeHints hints, ClassLoader classLoader) {
        Stream.of(
                "mapper/**/*Mapper.xml"
        ).forEach(hints.resources()::registerPattern);
//        hints.resources().registerPattern("ip2region.xdb");


        // hutool
        hints.reflection().registerType(Snowflake.class, MemberCategory.values());
        hints.reflection().registerType(BeanUtil.class, MemberCategory.values());
        hints.reflection().registerType(ObjectUtil.class, MemberCategory.values());
        hints.reflection().registerType(ReflectUtil.class, MemberCategory.values());

        hints.reflection().registerType(SpringContextUtil.class, MemberCategory.values());
        hints.reflection().registerType(JsonUtil.class, MemberCategory.values());
    }
}
